package ar.edu.itba.pod.legajo48240.balance;

import ar.edu.itba.node.NodeInformation;

public class NodeRank {
	
	private final NodeInformation node;
	private int agents;
	
	
	public NodeRank(NodeInformation node, int agents) {
		this.node=node;
		this.agents=agents;
	}
	public NodeInformation node(){
		return node;
	}
	public int agents(){
		return agents;
	}
	
	public void setAgent(int agents){
		this.agents=agents;
	}

	@Override
	public String toString() {
		return node.id() + " (" + agents+")";
	}
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((node == null) ? 0 : node.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		NodeRank other = (NodeRank) obj;
		if (node == null) {
			if (other.node != null)
				return false;
		} else if (!node.equals(other.node)){
			System.out.println( "String: " + node.id() + " differnt of " + this.node().id() );
			System.out.println(node.host() + node.id()+ node.port());
			System.out.println(this.node.host() + this.node.id()+ this.node.port());
			return false;
		}
		return true;
	}


	
}
